# -*- coding: utf-8 -*-
"""
@Author: Logan
@Date:   2025/7/1 16:47
@Description: 
"""
from selenium.webdriver.common.by import By

from base.ObjectMap import ObjectMap
from base.IframeBaiduBase import IframeBaiduBase


class IframeBaiduPage(IframeBaiduBase, ObjectMap):

    def input_baidu_map_search(self, driver, search_value):
        """
        输入百度地图搜索框
        :return:
        """
        search_input = self.baidu_search_input()
        return self.element_fill_value(driver, By.XPATH, search_input, search_value)

    def click_baidu_search_button(self, driver):
        """
        点击百度地图搜索按钮
        :param driver:
        :return:
        """
        button_xpath = self.baidu_map_search_button()
        return self.element_click(driver, By.XPATH, button_xpath)

    def switch_to_baidu_iframe(self, driver):
        """
        切换到百度地图iframe
        :param driver:
        :return:
        """
        iframe_xpath = self.baidu_map_iframe()
        return self.switch_into_iframe(driver, By.XPATH, iframe_xpath)

    def iframe_out(self, driver):
        """
        从百度地图切回主页面
        :param driver:
        :return:
        """
        return self.switch_from_iframe_to_content(driver)
